package com.psbc.swagger.controller;

import com.psbc.swagger.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "Hello Controller 类")  //描述整个类，或者说Controller的作用
public class HelloController {
    @RequestMapping("hello")
    public String hello(){
        return "hello,swagger";
    }

    @PostMapping(value = "/user")
    public User test(){
        return new User();
    }
    @ApiOperation("其实就是加了一个注释") //描述一个类的一个方法，或者说是一个接口
    @PostMapping(value = "/test")
    public User test(@ApiParam("用户，也是加一个注释") @RequestParam User user){
        return user;
    }
}
